package ActorObj;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class ActorFactory {
	
	private static Texture bombBallTexture=new Texture(Gdx.files.internal("f.png"));
	private static Texture gamePicBallTexture=new Texture(Gdx.files.internal("b.png"));
	private static Texture haloRegion=new Texture(Gdx.files.internal("gh.png"));
	
	
	public static Image	getRectangleActor(int w,int h,float r,float g,float b,float a) {
		int size=w>h?w:h;
		Pixmap backgrounPixmap= new Pixmap(size, size, Format.RGBA8888);
		backgrounPixmap.setColor(new Color(r/255f, g/255f, b/255f, a));
		backgrounPixmap.fillRectangle(0, 0, w, h);
		Texture texture=new Texture(backgrounPixmap);
		return new Image(new TextureRegion(texture, w, h));		
	}
	
	public static GameBallImage getGameBallImage(int radius,float r,float g,float b,float a) {
		int size=2;
		while (true) {
			if(size>=radius)
				break;
			size*=size;
		}
		Pixmap backgrounPixmap= new Pixmap(size, size, Format.RGBA8888);
		backgrounPixmap.setColor(new Color(r/255f, g/255f, b/255f, 1));
		backgrounPixmap.fillCircle(radius, radius, radius);
		Texture texture=new Texture(backgrounPixmap);
		return new GameBallImage(new TextureRegion(texture, radius*2+1, radius*2+1));
	}
	
	public static BombBall	getBombBall(int w,int h,float a) {
		
		BombBall bombBall=new BombBall(new TextureRegion(bombBallTexture, w, h));
		bombBall.getColor().a=a;
		bombBall.setOriginX(32);
		bombBall.setOriginY(32);
		return bombBall;		
	}
	
	
	public static GamePicBall getGamePicBall() {
		GamePicBall bombBall=new GamePicBall(new TextureRegion(gamePicBallTexture,30,30));
		return bombBall;
	}
	public static GamePicMainBall getGamePicMainBall() {
		GamePicMainBall bombBall=new GamePicMainBall(new TextureRegion(gamePicBallTexture,30,30),new TextureRegion(haloRegion));
		return bombBall;
	}
}
